package club.cearnach.api.service;

import club.cearnach.api.dto.HotMovieDTO;
import club.cearnach.api.dto.MovieDTO;
import club.cearnach.entity.Movie;
import club.cearnach.api.exception.*;
import club.cearnach.api.form.PageBean;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.io.IOException;
import java.util.List;


/**
 * @author 阮胜
 * @date 2018/5/4 19:38
 */
public interface IMovieService {
    Page<Movie> findAll(Pageable pageable);

    Movie save(Movie movie);

    Movie save(MovieDTO movieDTO) throws MovieTypeException, MovieLanguageException, MovieNotFoundException, MoviePathException, IOException;

    List<Movie> findByName(String name);

    Movie findByNameOne(String name);

    Movie findById(Integer id) throws MovieException;

    List<Movie> findByTypeId(Integer id);

    List<Movie> findByLanguageId(Integer id);

    void delete(Integer id) throws MovieException;

    @Deprecated
    Page<Movie> findAllOrderByInitialReleaseDate(PageBean pageBean);

    Page<Movie> findAllOrderByInitialReleaseDateDesc(PageBean pageBean);

    @Deprecated
    Page<Movie> findAllOrderByCreateDate(PageBean pageBean);

    long deleteIn(Integer[] idArr);

    @Deprecated
    Page<Movie> findAllOrderByRate(PageBean pageBean);

    Page<Movie> findAllOrderByCreateDateDesc(PageBean pageBean);

    Page<Movie> findAllOrderByRateDesc(PageBean pageBean);

    long count();

    List<HotMovieDTO> findHotMovie(Integer count);

    Integer findMovieHot(Integer movieId);

    void incrementMovieHot(Integer movieId);

    Long countMovieByTypeId(Integer id);

    Page<Movie> findAllByTypeIdOrderByCreateDateDesc(Integer typeId, PageBean pageBean);

    Page<Movie> findAllByCondition(String movieName, Integer typeId, Float rate, Integer startYear, Integer endYear, PageBean pageBean);
}
